namespace two {
    export interface IJewelryConfig {
        id: string,
        name: string,
        title: string,
        desc: string,
        star: string,
        icon: number,
        count: number[]
    }

    export class JewelryConfig {
        static getConfigById(id: string): IJewelryConfig {
            let cfgs = this.getAllConfigs();
            for (let i = 0; i < cfgs.length; i++) {
                if (cfgs[i].id == id) {
                    return cfgs[i];
                }
            }

            return null;
        }

        static getAllConfigs(): IJewelryConfig[] {
            return RES.getRes("jewelryCfg_json")['jewelry'] as IJewelryConfig[];
        }

        static getJewelrysByStar(starId:string):IJewelryConfig[] {
            let rs:IJewelryConfig[] = [];
            let cfgs = this.getAllConfigs();
            for (let i = 0; i < cfgs.length; i++) {
                if (cfgs[i].star == starId) {
                    rs.push(cfgs[i]);
                }
            }

            return rs;
        }
    }
}